home *** CD-ROM | disk | FTP | other *** search
/ Power DOS 1996 July / Power DOS - July 1996.iso / sound / c_labs / awe / adip.exe / ADIP02.ZIP / WINDOWS / SAMPLE / MCI.C < prev    next >
C/C++ Source or Header  |  1994-07-08  |  4KB  |  96 lines

  1. /*****************************************************************************
  2. *                                                                            *
  3. * MCI.C SB AWE32 MCI Support module                                          *
  4. *                                                                            *
  5. * (C) Copyright Creative Technology Ltd. 1992-94. All rights reserved        *
  6. * worldwide.                                                                 *
  7. *                                                                            *
  8. * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY      *
  9. * KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE        *
  10. * IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR      *
  11. * PURPOSE.                                                                   *
  12. *                                                                            *
  13. * You have a royalty-free right to use, modify, reproduce and                *
  14. * distribute the Sample Files (and/or any modified version) in               *
  15. * any way you find useful, provided that you agree to                        *
  16. * the Creative's Software Licensing Aggreement and you also agree that       *
  17. * Creative has no warranty obligations or liability for any Sample Files.    *
  18. *                                                                            *
  19. ******************************************************************************/
  20.  
  21. /*****************************************************************************
  22. *   File name   : MCI.C                                                      *
  23. *                                                                            *
  24. *   Programmer  : Nigel Tan/Cheng Kok Hoong                                  *
  25. *                 Creative Technology Ltd, 1994. All rights reserved.        *
  26. *                                                                            *
  27. *   MCI provides support routines for calling MCISEQ                         *
  28. *                                                                            *
  29. ******************************************************************************/
  30.  
  31. #include <windows.h>
  32. #include <mmsystem.h>
  33. #include <stdlib.h>
  34. #include "mci.h"
  35.  
  36. DWORD FAR PASCAL MCIOpenDevice (LPWORD lpwDeviceID, LPSTR szFileName)
  37. {
  38.     DWORD dwError;
  39.     MCI_OPEN_PARMS MciOpenParm;
  40.  
  41.     MciOpenParm.dwCallback = 0L;
  42.     MciOpenParm.wDeviceID = 0;
  43.     MciOpenParm.wReserved0 = 0;
  44.     MciOpenParm.lpstrDeviceType = NULL;
  45.     MciOpenParm.lpstrElementName = (LPSTR) szFileName;
  46.     MciOpenParm.lpstrAlias = NULL;
  47.     dwError = mciSendCommand(0, MCI_OPEN, MCI_WAIT| MCI_OPEN_ELEMENT,
  48.         (DWORD)(LPMCI_OPEN_PARMS)&MciOpenParm);
  49.  
  50.     *lpwDeviceID = MciOpenParm.wDeviceID;
  51.  
  52.     return dwError;
  53. }
  54.  
  55. DWORD FAR PASCAL MCIPlayDevice (HWND hWnd, WORD wDeviceID)
  56. {
  57.     DWORD dwError;
  58.     MCI_PLAY_PARMS MciPlayParm;
  59.  
  60.     // Send command to play.
  61.     MciPlayParm.dwCallback = (unsigned long)hWnd;
  62.     MciPlayParm.dwFrom = 0;
  63.     MciPlayParm.dwTo = 0;
  64.     dwError = mciSendCommand(wDeviceID, MCI_PLAY, MCI_NOTIFY,
  65.         (DWORD) (LPMCI_PLAY_PARMS)&MciPlayParm);
  66.  
  67.     return dwError;
  68. }
  69.  
  70. DWORD FAR PASCAL MCIEndPlay (WORD wDeviceID)
  71. {
  72.     DWORD dwError;
  73.     MCI_GENERIC_PARMS MciGenParm;
  74.  
  75.     MciGenParm.dwCallback = 0L;
  76.     dwError = mciSendCommand(wDeviceID, MCI_STOP, MCI_WAIT,
  77.         (DWORD)(LPMCI_GENERIC_PARMS)&MciGenParm);
  78.  
  79.     if(dwError) return dwError;
  80.  
  81.     return dwError;
  82. }
  83.  
  84. DWORD FAR PASCAL MCICloseDevice (WORD wDeviceID)
  85. {
  86.     DWORD dwError;
  87.     MCI_GENERIC_PARMS MciGenParm;
  88.  
  89.     MciGenParm.dwCallback = 0L;
  90.  
  91.     dwError = mciSendCommand(wDeviceID, MCI_CLOSE, MCI_WAIT,
  92.                     (DWORD)(LPMCI_GENERIC_PARMS)&MciGenParm);
  93.  
  94.     return dwError;
  95. }
  96.